<extend name='Yg/index' />
<block name='main'>
<div id="page-wrapper" >

            <div class="container-fluid">

                <!-- Page Heading -->
                <div class="row">
                    <div class="col-lg-12">
                        <h2 class="page-header">
                            职位管理
                        </h2>
                        <ol class="breadcrumb">
                            <li class="active">
                                <i class="fa fa-dashboard"></i> 您的位置 => 员工职位列表
                            </li>
                        </ol>
                    </div>
                </div>
                <form class="form-horizontal" action="<{:U('User/index')}>" method="get">
                            <div class="form-group">
                                 <label for="inputEmail3" class="col-sm-1 control-label">姓名：</label>
                                <div class="col-sm-3">
                                    <input type="text"   class="form-control"   id="inputEmail3"   name="n"   value="<PHP>echo $_GET['n']</PHP>" />
                                </div>
                                 <label for="inputPassword3" class="col-sm-1 control-label">部门：</label>
                                <div class="col-sm-3">
                                    <select class="form-control" id="sel" name="g">
                                        <option></option>
                                    <volist name='group' id='v'>
                                        <option value=<{$i}> <PHP>if($_GET['g']==$i){echo selected;}</PHP> ><{$v}></option>
                                    </volist>
                                    </select>
                                </div>
                            </div>
                        </form>
                <!-- /.row -->
                <table class="table table-striped table-bordered table-hover">
			<thead>
				<tr align='left' bgcolor="#D9EDF7">
					<th>ID</th>
					<th>真实姓名</th>
					<th>部门</th>
                    <th>部门操作</th>
					<th>职位</th>
					<th>职位操作</th>
                    
				</tr>
			</thead>
			<tbody id='ajax1'>
			<volist name="lista" id="vo" >
				<tr>
					<td><{$vo.id}></td>
					<td><{$vo.name}></td>
					<td><{$vo.gid.groupname}></td>
                    <td>
                        <a href="<{:U('Boss/bmtiaozheng',array('groupid'=>$vo['groupid'],'id'=>$vo['id']))}>">调整部门</a>
                    </td>
					<td><{$vo.pid.remark}></td>
					<td>
						<a href="<{:U('Boss/zwtiaozheng',array('id'=>$vo['id']))}>">调整职位</a>
					</td>
 
				</tr>
			</volist>
			</tbody>
			
			
		</table>
                <div class="pagination" id="fenye"><{$page}></div>        
            </div>
            <!-- /.container-fluid -->
            <script>
                $(document).ready(function(){

                    $('#sel').change(function(){
                        var g =$('#sel').val();
                        var username= $('#inputEmail3').val();
                        // console.log(username);
                        // console.log(g);

                        $.ajax({
                        type:"POST",
                        url:"<{:U('Boss/doAjax')}>",
                        dateType:'json',
                        data: {"g":g,"username":username},
                        // async:false,
                        success:function (info){
                            //清空之前查询的
                              $('#ajax1').empty();
                              $('#fenye').empty();
                         
                
                
                 
                 for (var i = 0; i < info.length; i++) {
                     // var lujing="<{"+info[i].url+"}>";
                     // console.log(lujing);
                    
                     $("<tr>").html($("<td>").html(info[i].id)).append($("<td>").html(info[i].name)).append($("<td>").html(info[i].gid.groupname)).append($("<td>").html($("<a href>").attr("href",info[i].url).html('调整部门'))).append($("<td>").html(info[i].pid.remark)).append($("<td>").html($("<a>").attr("href",info[i].zwtz).html('调整职位'))).appendTo('#ajax1');

                 }


                 

                }
            })
            })

            $('#inputEmail3').keyup(function(){
               var username= $('#inputEmail3').val();
               var g =$('#sel').val();
               // console.log(g);
               // console.log(username);

                $.ajax({
                type:"POST",
                url:"<{:U('Boss/doAjax')}>",
                dateType:'json',
                data: {"username":username,'g':g},
                success:function (info){
                    
                $('#ajax1').empty();  
                 $('#fenye').empty();
                 for (var i = 0; i < info.length; i++) {
                    $("<tr>").html($("<td>").html(info[i].id)).append($("<td>").html(info[i].name)).append($("<td>").html(info[i].gid.groupname)).append($("<td>").html($("<a href>").attr("href",info[i].url).html('调整部门'))).append($("<td>").html(info[i].pid.remark)).append($("<td>").html($("<a>").attr("href",info[i].zwtz).html('调整职位'))).appendTo('#ajax1');

                 }

                 }
                
            })

            })

        })
            </script>
        </div>


        <!-- /#page-wrapper -->
</block>